namespace SharpTalk.Core
{
    using System;
    using System.Runtime.Serialization;

    [DataContract]
    [Serializable]
    public sealed class ErrorDetails
    {
        public ErrorDetails(){}

        public ErrorDetails(string message)
        {
            Message = message;
        }

        public ErrorDetails(Exception exception)
        {
            this.Type = exception == null ? null : exception.GetType().Name;
            this.Message =  exception == null ? null : exception.Message;
        }
        [DataMember]
        public string Type { get; set; }
        [DataMember]
        public string Message { get; set; }

        public override string ToString()
        {
            return String.Format("Type:{0}, Message:{1}", Type, Message);
        }
    }
}